package com.gimi.cloud.jimi.dao.dao.userInfo;

import com.gimi.cloud.jimi.dao.dao.sys.BaseDao;
import com.gimi.cloud.jimi.dao.myMapper.MyMapper;
import com.gimi.cloud.jimi.dto.userInfo.RdJxlDTO;
import com.gimi.cloud.jimi.entity.userInfo.RdJxl;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface RdJxlDao extends MyMapper<RdJxl>,BaseDao<RdJxl, RdJxlDTO> {

    @Select("select * from rd_jxl where user_id = #{userId} and is_delete != 1 order by j_id desc limit 1")
    public RdJxl getNewestJxlByUser(Integer userId);

    @Select("SELECT j_id,report_effection_end FROM rd_jxl WHERE user_id = #{userId} ORDER BY j_id DESC LIMIT 1")
    RdJxlDTO getEffectionByUserId(@Param(value = "userId") Integer userId);
    
    @Select("SELECT * FROM rd_jxl WHERE report_effection_end > NOW() AND user_id = #{userId} limit 1")
	RdJxlDTO isEffection(@Param(value = "userId") Integer userId);
}
